home *** CD-ROM | disk | FTP | other *** search
Wrap
unit pSimpleBHO_TLB; // ************************************************************************ // // WARNING // ------- // The types declared in this file were generated from data read from a // Type Library. If this type library is explicitly or indirectly (via // another type library referring to this type library) re-imported, or the // 'Refresh' command of the Type Library Editor activated while editing the // Type Library, the contents of this file will be regenerated and all // manual modifications will be lost. // ************************************************************************ // // PASTLWTR : $Revision: 1.88 $ // File generated on 7/7/00 11:34:11 AM from Type Library described below. // *************************************************************************// // NOTE: // Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties // which return objects that may need to be explicitly created via a function // call prior to any access via the property. These items have been disabled // in order to prevent accidental use from within the object inspector. You // may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively // removing them from the $IFDEF blocks. However, such items must still be // programmatically created via a method of the appropriate CoClass before // they can be used. // ************************************************************************ // // Type Lib: F:\Program Files\Borland\Delphi5\Projects\BHO\pSimpleBHO.tlb (1) // IID\LCID: {5476D9C0-444E-11D4-ACEF-080000178968}\0 // Helpfile: // DepndLst: // (1) v2.0 stdole, (E:\WINNT\System32\StdOle2.Tlb) // (2) v4.0 StdVCL, (E:\WINNT\System32\STDVCL40.DLL) // ************************************************************************ // {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. interface uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL; // *********************************************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used: // Type Libraries : LIBID_xxxx // CoClasses : CLASS_xxxx // DISPInterfaces : DIID_xxxx // Non-DISP interfaces: IID_xxxx // *********************************************************************// const // TypeLibrary Major and minor versions pSimpleBHOMajorVersion = 1; pSimpleBHOMinorVersion = 0; LIBID_pSimpleBHO: TGUID = '{5476D9C0-444E-11D4-ACEF-080000178968}'; IID_IMyBHO: TGUID = '{5476D9C1-444E-11D4-ACEF-080000178968}'; CLASS_MyBHO: TGUID = '{5476D9C3-444E-11D4-ACEF-080000178968}'; IID_IInfoBHO: TGUID = '{5476D9CA-444E-11D4-ACEF-080000178968}'; CLASS_InfoBHO: TGUID = '{5476D9CC-444E-11D4-ACEF-080000178968}'; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// IMyBHO = interface; IInfoBHO = interface; IInfoBHODisp = dispinterface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// MyBHO = IMyBHO; InfoBHO = IInfoBHO; // *********************************************************************// // Interface: IMyBHO // Flags: (256) OleAutomation // GUID: {5476D9C1-444E-11D4-ACEF-080000178968} // *********************************************************************// IMyBHO = interface(IUnknown) ['{5476D9C1-444E-11D4-ACEF-080000178968}'] end; // *********************************************************************// // Interface: IInfoBHO // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {5476D9CA-444E-11D4-ACEF-080000178968} // *********************************************************************// IInfoBHO = interface(IDispatch) ['{5476D9CA-444E-11D4-ACEF-080000178968}'] end; // *********************************************************************// // DispIntf: IInfoBHODisp // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {5476D9CA-444E-11D4-ACEF-080000178968} // *********************************************************************// IInfoBHODisp = dispinterface ['{5476D9CA-444E-11D4-ACEF-080000178968}'] end; // *********************************************************************// // The Class CoMyBHO provides a Create and CreateRemote method to // create instances of the default interface IMyBHO exposed by // the CoClass MyBHO. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoMyBHO = class class function Create: IMyBHO; class function CreateRemote(const MachineName: string): IMyBHO; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TMyBHO // Help String : MyBHO Object // Default Interface: IMyBHO // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TMyBHOProperties= class; {$ENDIF} TMyBHO = class(TOleServer) private FIntf: IMyBHO; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TMyBHOProperties; function GetServerProperties: TMyBHOProperties; {$ENDIF} function GetDefaultInterface: IMyBHO; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IMyBHO); procedure Disconnect; override; property DefaultInterface: IMyBHO read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TMyBHOProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TMyBHO // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TMyBHOProperties = class(TPersistent) private FServer: TMyBHO; function GetDefaultInterface: IMyBHO; constructor Create(AServer: TMyBHO); protected public property DefaultInterface: IMyBHO read GetDefaultInterface; published end; {$ENDIF} // *********************************************************************// // The Class CoInfoBHO provides a Create and CreateRemote method to // create instances of the default interface IInfoBHO exposed by // the CoClass InfoBHO. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoInfoBHO = class class function Create: IInfoBHO; class function CreateRemote(const MachineName: string): IInfoBHO; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TInfoBHO // Help String : InfoBHO Object // Default Interface: IInfoBHO // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TInfoBHOProperties= class; {$ENDIF} TInfoBHO = class(TOleServer) private FIntf: IInfoBHO; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TInfoBHOProperties; function GetServerProperties: TInfoBHOProperties; {$ENDIF} function GetDefaultInterface: IInfoBHO; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IInfoBHO); procedure Disconnect; override; property DefaultInterface: IInfoBHO read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TInfoBHOProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TInfoBHO // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TInfoBHOProperties = class(TPersistent) private FServer: TInfoBHO; function GetDefaultInterface: IInfoBHO; constructor Create(AServer: TInfoBHO); protected public property DefaultInterface: IInfoBHO read GetDefaultInterface; published end; {$ENDIF} procedure Register; implementation uses ComObj; class function CoMyBHO.Create: IMyBHO; begin Result := CreateComObject(CLASS_MyBHO) as IMyBHO; end; class function CoMyBHO.CreateRemote(const MachineName: string): IMyBHO; begin Result := CreateRemoteComObject(MachineName, CLASS_MyBHO) as IMyBHO; end; procedure TMyBHO.InitServerData; const CServerData: TServerData = ( ClassID: '{5476D9C3-444E-11D4-ACEF-080000178968}'; IntfIID: '{5476D9C1-444E-11D4-ACEF-080000178968}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TMyBHO.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IMyBHO; end; end; procedure TMyBHO.ConnectTo(svrIntf: IMyBHO); begin Disconnect; FIntf := svrIntf; end; procedure TMyBHO.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TMyBHO.GetDefaultInterface: IMyBHO; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation'); Result := FIntf; end; constructor TMyBHO.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TMyBHOProperties.Create(Self); {$ENDIF} end; destructor TMyBHO.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TMyBHO.GetServerProperties: TMyBHOProperties; begin Result := FProps; end; {$ENDIF} {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TMyBHOProperties.Create(AServer: TMyBHO); begin inherited Create; FServer := AServer; end; function TMyBHOProperties.GetDefaultInterface: IMyBHO; begin Result := FServer.DefaultInterface; end; {$ENDIF} class function CoInfoBHO.Create: IInfoBHO; begin Result := CreateComObject(CLASS_InfoBHO) as IInfoBHO; end; class function CoInfoBHO.CreateRemote(const MachineName: string): IInfoBHO; begin Result := CreateRemoteComObject(MachineName, CLASS_InfoBHO) as IInfoBHO; end; procedure TInfoBHO.InitServerData; const CServerData: TServerData = ( ClassID: '{5476D9CC-444E-11D4-ACEF-080000178968}'; IntfIID: '{5476D9CA-444E-11D4-ACEF-080000178968}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TInfoBHO.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IInfoBHO; end; end; procedure TInfoBHO.ConnectTo(svrIntf: IInfoBHO); begin Disconnect; FIntf := svrIntf; end; procedure TInfoBHO.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TInfoBHO.GetDefaultInterface: IInfoBHO; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation'); Result := FIntf; end; constructor TInfoBHO.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TInfoBHOProperties.Create(Self); {$ENDIF} end; destructor TInfoBHO.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TInfoBHO.GetServerProperties: TInfoBHOProperties; begin Result := FProps; end; {$ENDIF} {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TInfoBHOProperties.Create(AServer: TInfoBHO); begin inherited Create; FServer := AServer; end; function TInfoBHOProperties.GetDefaultInterface: IInfoBHO; begin Result := FServer.DefaultInterface; end; {$ENDIF} procedure Register; begin RegisterComponents('Servers',[TMyBHO, TInfoBHO]); end; end.